<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta name="format-detection" content="telephone=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="mobile-web-app-capable" content="yes">
	<meta name="msapplication-tap-highlight" content="no">
	<script type="text/javascript" src="<%=commonPath %>/pageRc/js/jquery-1.9.1.min.js"></script> 
 　	<link rel="stylesheet" href="<%=commonPath %>/pageRc/layui/css/layui.css" media="all">
   	<link rel="stylesheet" href="<%=commonPath %>/res/css/global.css"> 
　　　<script type="text/javascript" src="<%=commonPath %>/pageRc/common/utils.js"></script>
	<script type="text/javascript" src="<%=commonPath %>/pageRc/common/msgTool.js"></script>
	<script type="text/javascript" src="<%=commonPath %>/pageRc/layui/layui.js"></script>　
<title>历史查询</title>

</head>
<body>
	 <div class="header">
		<blockquote class="layui-elem-quote">历史查询</blockquote>  
	 </div>
	<form id="createMsgForm" name="createMsgForm" class="layui-form"
		action="">
		<input type="hidden" class="layui-input" value="${rouid}" id="rouid" />
		<div class="layui-form-item">
			<div class="layui-inline">
					<div class="layui-inline" style="text-align: center;">
						<input class="layui-input" style="width: 160px; display: inline;" id="needName" value="${needName}"
							placeholder="需求名称">
						<input class="layui-input" style="margin-left:20px; width: 160px; display: inline;" id="needNo" value="${needNo}"
							placeholder="需求编号">
					</div>
			</div>
			<div class="layui-inline">
				<div class="layui-inline" style="text-align: center;">
					<input class="layui-input" style="width: 160px; display: inline;" id="startDate" value="${startDate}"
						onclick="layui.laydate({elem: this, istime: true, format: 'YYYYMMDD'})"
						placeholder="开始日期">
					<input class="layui-input" style="margin-left:20px; width: 160px; display: inline;" id="endDate" value="${endDate}"
						onclick="layui.laydate({elem: this, istime: true, format: 'YYYYMMDD'})"
						placeholder="结束日期">
				</div>
				<div class="layui-inline">
					<button class="layui-btn" style="margin-left: 30px;" type="button" onClick="searchHistory()">查询</button>
				</div>
			</div>
		</div>
	</form>
	<div style="layui-main"> 
         　  			<ul class="fly-list fly-list-top">  
	           <c:forEach items="${list}" var="need" > 
	     			<li class="fly-list-li" style="height: 60px;padding: 5px;">
		              <button class="layui-btn" onClick="deleteInfor('${need.rouid}')" ><i class="layui-icon">&#xe640;</i></button>
			           <h2 class="fly-tip"> 
			            <a href="">
			            ${need.happenDate}&nbsp;&nbsp;
			                ${need.needNo}/
				            <c:if test="${fn:length(need.needName) > 6 }">
								${fn:substring(need.needName,0,6)}...
							</c:if>
							<c:if test="${fn:length(need.needName)  <= 6 }">
								${need.needName}
							</c:if>
						</a>
			           </h2>
			          <p style="height:20px">
			            <span><a href="">${need.needUseTime}/${need.stage}</a></span>
			            &nbsp;&nbsp;
			            <c:if test="${fn:length(need.remark) > 8 }">
							${fn:substring(need.remark,0,8)}...
						</c:if>
						<c:if test="${fn:length(need.remark)  <= 8 }">
							${need.remark}
						</c:if>
						&nbsp;&nbsp;		
			            <c:if test="${need.reportState == '00'}">
			            	<span style="color: red;">未审核</span>
			            </c:if>
			            <c:if test="${need.reportState == '01'}">
			            	<span>审核通过</span>
			            </c:if>
			            <c:if test="${need.reportState == '02'}">
			            	<span style="color: red;">审核未通过</span>
			            </c:if>
			          </p>
		          </li>
	 	       </c:forEach> 
	    　　 </ul>    
	</div>			
</body>
<script type="text/javascript">
var path="<%=commonPath%>";
var msg = new msgTool();
layui.use([ 'form', 'layer', 'laytpl', 'laypage', 'laydate' ],
		function(){
	layer = layui.layer;
});

	function searchHistory(){
		var needName = $("#needName").val();
		var needNo = $("#needNo").val();
		var startDate = $("#startDate").val();
		var endDate = $("#endDate").val();
		var rouid = $("#rouid").val();
		var pars = "needName="+needName+"&needNo="+needNo+"&startDate="+startDate+"&endDate="+endDate+"&rouid="+rouid;
		var href = "<%=commonPath %>/page/job/searchHistoryJob.do?"+pars;
		location.href = href;
	}
	 
	function deleteInfor(rouid) {
       layer.confirm("确认删除该条报工记录?", {icon:3,title:"提示"},function(index){
			msg.sendMsg("/page/base/"+rouid+"/deleteUserNeedInfor.do",{},function(data){
				var rsObj = null;
				var href = "";
				var needName = $("#needName").val();
				var needNo = $("#needNo").val();
				var startDate = $("#startDate").val();
				var endDate = $("#endDate").val();
				var userId = $("#rouid").val();
				var pars = "needName="+needName+"&needNo="+needNo+"&startDate="+startDate+"&endDate="+endDate+"&rouid="+userId;
				var href = "<%=commonPath %>/page/job/searchHistoryJob.do?"+pars;
				layer.alert("删除成功！");
				var size = "${size}";
		  		if(size=='1'){
					location.href ="<%=commonPath %>/page/base/dologin.do";
		  		}else{
					location.href = href;
		  		}
			});
	   }); 
	}
	 
</script>

</html>